import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'
import Login from './components/Login'
import Home from './components/Home'
import Product from './components/Product'
import Book from './components/Book'
import Classic from './components/Classic'
import Agricultrue from './components/Agricultrue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';


Vue.config.productionTip = false

Vue.use(VueRouter)
Vue.use(ElementUI);


// 配置路由表
const routes = [{
  path: '/',
  redirect: '/product'   // 重定向到/product
},{
  path: '/login',
  name: 'login',
  component: Login
},{
  path: '/',
  name: 'home',
  component: Home,
  children: [
    {
      path: '/product',
      component: Product
    },
    {
      path: '/classic',
      component: Classic
    },{
      path: '/agricultrue',
      component: Agricultrue
    },{
      path: '/book',
      component: Book
    }
  ]
}]

// 初始化vue router对象
const router = new VueRouter({
  routes: routes
})

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
